#ifndef LSW100_H
#define LSW100_H

#include "includes.h"
#include "weight.h"
#include "DebugComm.h"
#include "Queue.h"
#include "ParamCfg.h"
#include "datastore.h"
#include "hostcomm.h"
#include "datetime.h"

#define AD_MODULE_EN  				1
#define DISPLAY_MODULE_EN	  		1
#define HOSTCOMM_MODULE_EN 			0
#define LSW100_MODULE_EN    		1
#define MEM_STORE_MODULE_EN 		1
#define RS232_DEBUG_MODULE_EN 		1
#define STATIC_WEIGHT_MODULE_EN 	1
#define DYNAMIC_WEIGHT_MODULE_EN 	1
#define TEST_MODULE_EN			    1

#define SYS_MODE_MASTER 1
#define SYS_MODE_SLAVE  0
#define SYS_MODE  		SYS_MODE_SLAVE
#define LSW_VERSION			100
#define TASK_DEF_STK_SIZE       128

typedef enum task_prio{
	TASK_PROI_AD_SAMPLE   	= 4,
	TASK_PROI_DBG_COM_RECV,
	TASK_PROI_DBG_COM_SEND,
	TASK_PROI_CPU_INTER,
	TASK_PROI_DATA_STORE,
	TASK_PROI_DATA_RECV,
	TASK_PROI_DATA_SEND,
	TASK_PROI_DISPLAY,
	TASK_PROI_TESTSUITE,
}TASK_PROI_T;
#if 0
#define TASK_PROI_AD_SAMPLE   	2
#define TASK_PROI_DBG_COM_RECV  3
#define TASK_PROI_DBG_COM_SEND  4
#define TASK_PROI_CPU_INTER		5
#define TASK_PROI_DATA_STORE	6
#define TASK_PROI_DATA_RECV 	7
#define TASK_PROI_DATA_SEND 	8
#endif
#define ALARM_OK	0
#define ALARM_ERR   1
typedef struct{
	unsigned dev1      :1 ;
	unsigned dev2      :1 ;
	unsigned gm        :1 ;
	unsigned temp	   :1 ;
	unsigned sensor1   :1 ; 
	unsigned sensor2   :1 ;
	unsigned sensor3   :1 ; 
	unsigned sensor4   :1 ;
}TState;

typedef union 
{
	TState arm;
	u8     value;
}TALARM;


typedef struct{
	u8       mode;
	u16 	 dev_addr;
	TALARM	 alarm;
}LSW100_Device;
extern u16 Tick2Ms(u16 tick);
extern u16 Ms2Tick(u16 ms);
extern BOOL IS_Send2Me(u16 id);
extern LSW100_Device lsw100;
extern u8 	cmd_route_table(u8 src,TCommMsg *msg);
#endif
